package com.sangmo.fts.user.service;

import com.sangmo.boot.framework.common.session.UserSession;
import com.sangmo.boot.framework.plugin.dataview.crud.service.DelegateViewService;
import com.sangmo.boot.framework.plugin.dataview.crud.service.ViewService;
import com.sangmo.fts.user.model.Account;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;

@Service
@Transactional
public class AccountService extends DelegateViewService<Account> {

    @Autowired
    private AccountEntityService accountEntityService;

    @Override
    protected ViewService<Account> getEntityService() {
        return accountEntityService;
    }

    public Account getAccountInfo() {
        Long userId = (Long) UserSession.getUserInterface().getId();
        return accountEntityService.findByUserId(userId);
    }


}
